package role

import (
	"context"

	"go-zero-mall/app/admin/cmd/api/internal/svc"
	"go-zero-mall/app/admin/cmd/api/internal/types"
	"go-zero-mall/app/admin/cmd/rpc/pd"

	"github.com/jinzhu/copier"
	"github.com/zeromicro/go-zero/core/logx"
)

type RoleAllocMenuLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewRoleAllocMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RoleAllocMenuLogic {
	return &RoleAllocMenuLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *RoleAllocMenuLogic) RoleAllocMenu(req *types.RoleAllocMenuReq) (resp *types.RoleAllocMenuResp, err error) {
	var in pd.UmsRoleAllocMenuReq
	copier.Copy(&in, req)
	l.svcCtx.AdminRpc.RoleAllocMenu(l.ctx, &in)
	return
}
